﻿using ECommerce.Web.Validation.ModelValidators;
using FluentValidation.TestHelper;
using Machine.Specifications;

namespace Basket_item_validation_specs
{
    [Subject("Basket item validation")]
    public class When_validating_a_basket_item
    {
        private static BasketItemValidator validator;

        Establish context = () =>
            {
                validator = new BasketItemValidator();
            };

        It should_raise_error_for_quantity_less_than_0 = () =>
            {
                validator.ShouldHaveValidationErrorFor(item => item.Quantity, -1);
            };

        It should_not_raise_error_for_quantity_greater_than_minus_1 = () =>
            {
                validator.ShouldNotHaveValidationErrorFor(item => item.Quantity, 0);
            };
    }
}
